package leetcode;
import java.util.*;
public class test {
public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    sc.nextLine();
    String correct=sc.nextLine();
    Set keys=new HashSet<String>();
    int min=0;
    int[] keylength=new int[1000];

    for(int i=1; i<=n; i++){
        String temp=sc.nextLine();
        if(keys.add(temp)){
            keylength[temp.length()]++;
        }
    }
    for(int i=0; i<correct.length(); i++){
        min+=keylength[i];
    }
    min++;
    int max=min+keylength[correct.length()]-1;


    System.out.println(min+" "+max);

}

}
